# Maintainer: nobody

_realname=libconfini
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.14.1
pkgrel=1
pkgdesc='Yet another INI parser (mingw-w64)'
arch=('any')
url='https://madmurphy.github.io/libconfini'
license=('GPL')
options=('staticlibs')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/madmurphy/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('bbf59409b65812fcc41ed86a20a1dc478d78249fc5c2bd5ba68eeeda41106859')
noextract=(${_realname}-${pkgver}.tar.gz)

prepare() {
  [ -d "${srcdir}/${_realname}-${pkgver}" ] && rm -rf "${srcdir}/${_realname}-${pkgver}"
  tar -xzf "${srcdir}/${_realname}-${pkgver}.tar.gz" -C "${srcdir}"
  cd "${srcdir}/${_realname}-${pkgver}"
  ./bootstrap --noconfigure
}

build() {
  [ -d "${srcdir}/build-${MINGW_CHOST}" ] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
      --prefix="${MINGW_PREFIX}" \
      --build="${MINGW_CHOST}" \
      --host="${MINGW_CHOST}" \
      --enable-shared \
      --enable-static
  make
}

check() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make check
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
